package com.ma4567.remotecontroller.LocalController;

import com.ma4567.remotecontroller.RemoteControllerApplication;
import com.ma4567.remotecontroller.UserManager.LoggedUser;
import com.ma4567.remotecontroller.UserManager.User;

import java.util.Scanner;

public class LocalCommand {
    public LocalCommand() {
        while(true){
            Scanner scanner = new Scanner(System.in);
            String command = scanner.nextLine();
            if(command.equals("/exit")){
                RemoteControllerApplication.CloseApplication();
            } else if (command.equals("/show user list")) {
                System.out.println("Saved User Number: " + RemoteControllerApplication.userManager.users.size());
                for(User u: RemoteControllerApplication.userManager.users){
                    System.out.println(u.toString());
                }
            }else if (command.equals("/show logged user list")) {
                System.out.println("Logged User Number: " + RemoteControllerApplication.userManager.loggedUsers.size());
                for(LoggedUser u: RemoteControllerApplication.userManager.loggedUsers){
                    System.out.println(u.toString());
                }
            } else if(command.equals("/help")){
                System.out.println("/exit\n/show user list\n/show logged user list");
            } else {
                System.out.println("use /help to show commands list");
            }
        }
    }
}
